/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/
#ifndef IPC_HW_SEM_H_
#define IPC_HW_SEM_H_
#include "sys_base_reg.h"
// #include "base_types.h"
#include "custom_Std_Types.h"

typedef enum{
    SEM_BANK_ID0,
    SEM_BANK_ID1,
}un_bank_id;

typedef enum{
    SEM_ID_0,
    SEM_ID_1,
    SEM_ID_2,
    SEM_ID_3,
    SEM_ID_4,
    SEM_ID_5,
}un_sem_id;

typedef enum{
    SEM_MST_ID0,
    SEM_MST_ID1,
    SEM_MST_ID2,
    SEM_MST_ID3,
    SEM_MST_ID4,
    SEM_MST_ID5,
    SEM_MST_ID6,
}un_mst_id;

typedef union {
    struct {
        uint32 res:2;
        uint32 sem_id:4;
        uint32 intr:1;
        uint32 bank_id:2;
        uint32 mst_id:4;
        uint32 base_addr:19;
    }bit;
    uint32 data;
}un_reg_sem_u;

uint32 get_sem_lock(uint8 sem_id);
uint32 release_sem_lock(uint8_t sem_id);

#endif